{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d31d3b31",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import cv2\n",
    "import numpy as np\n",
    "\n",
    "img = cv2.imread('image0.jpg',1)\n",
    "for i in range(200,300):\n",
    "    img[i,200] = (255,255,255)\n",
    "    img[i,200+1] = (255,255,255)\n",
    "    img[i,200-1] = (255,255,255)\n",
    "for i in range(150,250):\n",
    "    img[250,i] = (255,255,255)\n",
    "    img[250+1,i] = (255,255,255)\n",
    "    img[250-1,i] = (255,255,255)\n",
    "cv2.imwrite('damaged.jpg',img)\n",
    "cv2.imshow('damaged',img)\n",
    "cv2.waitKey(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "bc28e01d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import cv2\n",
    "import numpy as np\n",
    "\n",
    "img = cv2.imread('damaged.jpg',1)\n",
    "imgInfo = img.shape\n",
    "height = imgInfo[0]\n",
    "width = imgInfo[1]\n",
    "paint = np.zeros((height,width,1),np.uint8)\n",
    "for i in range(200,300):\n",
    "    paint[i,200] = 255\n",
    "    paint[i,200+1] = 255\n",
    "    paint[i,200-1] = 255\n",
    "for i in range(150,250):\n",
    "    paint[250,i] = 255\n",
    "    paint[250+1,i] = 255\n",
    "    paint[250-1,i] = 255\n",
    "    \n",
    "imgDst = cv2.inpaint(img,paint,3,cv2.INPAINT_TELEA)\n",
    "\n",
    "cv2.imshow('damaged',imgDst)\n",
    "cv2.waitKey(0)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
